<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // 编码   => 将字符串编码为有效的统一资源标识符 (编码中文和特殊字符)
    // encodeURI()
    // encodeURIComponent()   => 升级版(编码范围更广)

    // 解码  => 将统一资源标识符 解码还原为 原本的字符串
    // decodeURI()
    // decodeURIComponent()


    var str = "老王123456789abcdefg+-*/%?{}[]"
    var enStr1 = encodeURI(str);
    console.log(enStr1);

    var enStr2 = encodeURIComponent(str);
    console.log(enStr2);

    var deStr1 = decodeURI(enStr1);
    console.log(deStr1);
    var deStr2 = decodeURIComponent(enStr2);
    console.log(deStr2);

    






</script>
</html>